import java.util.HashSet;
import java.util.Set;

/**
 * 分糖果
 * https://leetcode-cn.com/problems/distribute-candies/
 */
public class Candy {

    public int getCandy(int[] nums){
        int mid=nums.length/2;
        Set<Integer> tempSet=new HashSet<>();
        for (int i = 0; i <nums.length ; i++) {
            tempSet.add(nums[i]);
        }
        if(tempSet.size()<mid){
            return tempSet.size();
        }else {
            return mid;
        }
    }
}
